package com.sx.wechat.command.api;

import com.sx.core.mybatis.SessionTemplate;
import com.sx.core.vo.JsonReaderResponse;
import com.sx.wechat.command.cmd.AbstractCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 挂失解挂
 * Created by lihao on 2018/3/21.
 */
@Component("list_order_student")
public class List_order_student extends AbstractCommand {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    SessionTemplate sessionTemplate;

    @Override
    public Object executeApi(HttpServletRequest request, HttpServletResponse response) {
        String orderid=obtain(request,"orderid");
        String r_sql="select " +
                "rs.*,  " +
                "i.name as stuname, " +
                "c.name as classname " +
                "from t_order_rec_stu rs " +
                "JOIN t_information i on rs.stuid=i.id " +
                "JOIN t_class c on rs.classid=c.id " +
                "WHERE rs.orderid=?";
        List<Map<String,Object>> list=jdbcTemplate.queryForList(r_sql,orderid);

        return new JsonReaderResponse(list);

    }

}
